package com.phkj.qdh.ui.adapter

import android.content.Context
import android.view.ViewGroup
import android.widget.CheckBox
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import com.hjq.shape.view.ShapeCheckBox
import com.phkj.qdh.R
import com.phkj.qdh.bean.ApprovalManBean

class CommonSelectAdapter:BaseQuickAdapter<CommonSelectBean,QuickViewHolder>() {
    override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: CommonSelectBean?) {
        val cb = holder.getView<CheckBox>(R.id.cb)
        cb.setOnCheckedChangeListener(null)
        cb.isChecked = item!!.isSelected
        holder.setText(R.id.tv_name,item?.s?:"")
    }

    override fun onCreateViewHolder(
        context: Context,
        parent: ViewGroup,
        viewType: Int
    ): QuickViewHolder {
      return QuickViewHolder(R.layout.item_approval_man,parent)
    }
}

data class CommonSelectBean(
    val s: String,
    var isSelected:Boolean = false
)